if not ds then
  ds = {}
end

if ds.DataSetMgr then
  return
end

local DataSetMgr = object:new()
ds.DataSetMgr = DataSetMgr
ds.DataSetMgr.m_comps = {}
 
function DataSetMgr:getInstance()
  return ds.DataSetMgr
end

function DataSetMgr:destroyInstance()
  ds.DataSetMgr = nil
end
function DataSetMgr:destroyAllComps()
  for idx = table.maxn(self.m_comps), 1, -1 do
    self.m_comps[idx]:destroy()
    self.m_comps[idx] = nil
  end
  self.m_comps = {}
end

function DataSetMgr:init()
  self:destroyAllComps()
  
  ds.Account = require("ds/Account").new()
  ds.Register = require("ds/Register").new()
  ds.Launcher = require("ds/Launcher").new()
 
  table.insert(self.m_comps, ds.Account)
  table.insert(self.m_comps, ds.Register)
  table.insert(self.m_comps, ds.Launcher)
 
  for k, v in pairs(self.m_comps) do
    if v:init() == false then
      cclog("init component fail!")
      return false
    end
  end
  cclog("init component success!")
end
